class Solution {
public:
    int climbStairs(int n) {
        std::vector<int> dp(n+1);

        dp[0] = 1;
        dp[1] = 1;

        for(int i = 2; i <= n; i++)
            dp[i] = dp[i-1] + dp[i-2];

        return dp[n];
    }
};

class Solution {
public:
    int climbStairs(int n) {
        int pre1 = 1;
        int pre2 = 1;

        for(int i = 2; i <= n; i++)
        {
            int cnt = pre1 + pre2;
            pre2 = pre1;
            pre1 = cnt;
        }

        return pre1;
    }
};